package com.example.njupt.views.automatic;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

/**
 * Author:      mwang
 * Create Date: Created in 2021/4/19 15:07
 * Update Date:
 * Modified By:
 * Description:
 */
public abstract class AutomaticAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {

    private List<Object> list;
    private Context context;

    public AutomaticAdapter(Context context, List<Object> list) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getItemCount() {
        return Integer.MAX_VALUE;
    }

    /**
     * 事件回调监听
     */
    private OnItemClickListener onItemClickListener;

    /**
     * 设置回调监听
     *
     * @param listener
     */
    public void setOnItemClickListener(@NonNull OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    public interface OnItemClickListener {
        void onItemClick(int position);
    }
}
